package edu.rolePra.controller;

import edu.rolePra.pojo.Role;
import edu.rolePra.service.RoleService;
import edu.rolePra.service.impl.RoleServiceImpl;

import java.util.List;

public class RoleTest {

    public static void main(String[] args) {
        Role role = new Role("admin", "超级管理员");
        Role role2 = new Role("user", "普通用户");
        Role role3 = new Role("student", "学生");
        //通过业务层操作  即可
        RoleService roleService = new RoleServiceImpl();
        roleService.insertRole(role);
        roleService.insertRole(role2);
        roleService.insertRole(role3);
        //获取所有角色信息
        List<Role> roles = roleService.getRoles();

        for (Role role1 : roles) {
            System.out.println(role1);
        }
        System.out.println("-----------------------------------");
        //++++++++++++++++++++++++++++++另外一个人的操作
        Role role4 = new Role("teacher", "教师");
        //通过业务层操作  即可
        RoleService roleService2 = new RoleServiceImpl();
        roleService2.insertRole(role4);
        //获取所有角色信息
        List<Role> rolesList = roleService2.getRoles();

        for (Role role1 : rolesList) {
            System.out.println(role1);
        }

        //建议使用scanner模拟添加信息  获取信息.....

        
    }
}
